Skip to content

Feat forgot password endpoint#721

Merged
yusuftomilola merged 3 commits into
DistinctCodes:mainfrom
RUKAYAT-CODER:feat-forgot-password-endpoint
Apr 26, 2026
Merged

Feat forgot password endpoint#721
yusuftomilola merged 3 commits into
DistinctCodes:mainfrom
RUKAYAT-CODER:feat-forgot-password-endpoint

Conversation

@RUKAYAT-CODER
Copy link
Copy Markdown
Contributor

close #598
close #601

Task 1: Excel and PDF Export Endpoints
Reports Module Created:

backend/contrib/src/reports/reports.module.ts - Module definition with Asset entity
backend/contrib/src/reports/reports.service.ts - Service with Excel and PDF generation
backend/contrib/src/reports/reports.controller.ts - Controller with protected endpoints
Endpoints Implemented:

GET /reports/export/excel - Generates .xlsx using exceljs with formatted table
GET /reports/export/pdf - Generates PDF using pdfkit with title, date, and asset table
Features:

Both endpoints protected by JwtAuthGuard
Excel columns: Asset ID, Name, Category, Department, Status, Condition, Purchase Price, Location, Created Date
PDF mirrors same columns in readable layout
Proper Content-Type and Content-Disposition headers

Task 2: Forgot Password and Reset Password Endpoints
Password Reset Token Entity:

backend/contrib/src/auth/password-reset-token.entity.ts - Entity with id, userId, tokenHash, expiresAt, usedAt
Mail Module:

backend/contrib/src/mail/mail.module.ts - Mail module configuration
backend/contrib/src/mail/mail.service.ts - Nodemailer service for email sending
Auth Endpoints:

POST /auth/forgot-password - Accepts { email }, generates 15-minute token, stores hashed token, sends email
POST /auth/reset-password - Accepts { token, newPassword }, validates token, updates password, invalidates token
DTOs Created:

backend/contrib/src/auth/dto/forgot-password.dto.ts - Email validation
backend/contrib/src/auth/dto/reset-password.dto.ts - Token and new password validation
Environment Variables Required:

MAIL_HOST, MAIL_PORT, MAIL_USER, MAIL_PASS, MAIL_FROM
FRONTEND_URL (optional, defaults to http://localhost:3000/)
All dependencies have been installed, modules properly configured, and the ReportsModule has been added to the main AppModule. The implementation follows NestJS best practices with proper error handling, validation, and security measures.

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 25, 2026

Someone is attempting to deploy a commit to the naijabuz's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Apr 25, 2026

@RUKAYAT-CODER Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@yusuftomilola yusuftomilola merged commit 0bee7ef into DistinctCodes:main Apr 26, 2026
0 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BE-36] Implement forgot password and reset password endpoints [BE-33] Implement Excel and PDF export endpoints in Reports module

2 participants